package com.lzy.cloud.permission.facade;

import com.lzy.cloud.permission.dtos.UserRoleDto;
import com.lzy.cloud.permission.service.RoleService;
import com.lzy.cloud.permission.service.UserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Created by WIN7 on 2018/5/18.
 */
@Component
public class RoleFacade {

    @Autowired
    RoleService roleService;

    @Autowired
    UserRoleService userRoleService;

    /**
     * 删除角色
     *
     * @param id
     * @return
     */
    public Boolean delete(Long id) {
        //删除用户角色关联表
        UserRoleDto userRoleDto = new UserRoleDto();
        userRoleDto.setRoleId(id);
        userRoleService.deleteByKey(userRoleDto);
        //删除角色主表
        return roleService.delete(id);
    }


}
